#ifndef TEXTSPEAK_H
#define TEXTSPEAK_H

#include <QtCore>
#include <sapi.h>
#include <sphelper.h>

class TextSpeak : public QThread
{
    Q_OBJECT
public:
    TextSpeak();
    ~TextSpeak();

    void speak(const QString &text);
    void setVoice(const QString &name);
    void setRate(int rate);
    void setPitch(int pitch);
    void setVolume(int volume);

Q_SIGNALS:
    void doSpeakBuffer(const QByteArray &data, const QString &text);

private Q_SLOTS:
    void onInit(QEventLoop *loop);
    void onExitThread();
    void onPushText(const QString &text);
    void onSetVoice(const QString &name);
    void onSetRate(int rate);
    void onSetVolume(int volume);

private:
    ISpVoice *voice_;
    IStream *stream_;
    float speedIncrease_;
    float volumnIncrease_;
};

#endif // TEXTSPEAK_H
